package com.exm.sql.controller;

import com.exm.sql.annotation.RequestField;
import com.exm.sql.model.User;
import com.exm.sql.model.vo.ResponseResult;
import com.exm.sql.service.UserSerivce;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LoginController {

    @Autowired
    UserSerivce userSerivce;


    @RequestMapping("/login")

    public ResponseResult login(@RequestField("account")String account, @RequestField("password")String password) {
      return   userSerivce.doLogin(account, password);
    }


    @RequestMapping("/register")
    public ResponseResult register(@RequestBody User user) {
        return   userSerivce.doRegister(user);
    }


}
